//
//  AppDelegate.swift
//  Sina_Weibo2
//
//  Created by Elsevier on 16/5/9.
//  Copyright © 2016年 Yang Lu. All rights reserved.
//

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        
        setupAppearance()
        
        window = UIWindow(frame: UIScreen.mainScreen().bounds)
        
        let tabBarVC = LYMainTabBarController()
        tabBarVC.view.backgroundColor = UIColor.whiteColor()
        window?.rootViewController = tabBarVC
//        window?.rootViewController = LYWelcomeViewController()
        
        window?.makeKeyAndVisible()
        
        return true
    }
    
    private func isNewVersion() -> Bool {
        let currentVersion = NSBundle.mainBundle().infoDictionary!["CFBundleShortVersionString"]as! String
        
        let sandboxVersionKey = "sandbixVersionKey"
        let sandboxVersion = NSUserDefaults.standardUserDefaults().stringForKey(sandboxVersionKey)
        let isNewVersion = currentVersion != sandboxVersion
        
        if isNewVersion {
            NSUserDefaults.standardUserDefaults().setObject(currentVersion, forKey: sandboxVersionKey)
                NSUserDefaults.standardUserDefaults().synchronize()
        }
        return isNewVersion
    }
    
    /// 设置导航栏的皮肤,越早设置越好
    private func setupAppearance() {
        let bar = UINavigationBar.appearance()
        bar.tintColor = UIColor.orangeColor()
    }
}

